﻿using System.IO;
using FortuneUniverse.Fortune.Algorithms;

namespace FortuneUniverse.Fortune.Dyson
{
  public struct VegeData
  {
    public int id;
    public short protoId;
    public short modelIndex;
    public short hp;
    public Vector3 pos;
    public Quaternion rot;
    public Vector3 scl;
    public int modelId;
    public int colliderId;

    public void SetNull()
    {
      this.id = 0;
      this.protoId = (short) 0;
      this.modelIndex = (short) 0;
      this.hp = (short) 0;
      this.pos.x = 0.0f;
      this.pos.y = 0.0f;
      this.pos.z = 0.0f;
      this.rot.x = 0.0f;
      this.rot.y = 0.0f;
      this.rot.z = 0.0f;
      this.rot.w = 0.0f;
      this.scl.x = 0.0f;
      this.scl.y = 0.0f;
      this.scl.z = 0.0f;
      this.modelId = 0;
      this.colliderId = 0;
    }

    public void Export(BinaryWriter w)
    {
      w.Write(0);
      w.Write(this.id);
      w.Write(this.protoId);
      w.Write(this.modelIndex);
      w.Write(this.hp);
      w.Write(this.pos.x);
      w.Write(this.pos.y);
      w.Write(this.pos.z);
      w.Write(this.rot.x);
      w.Write(this.rot.y);
      w.Write(this.rot.z);
      w.Write(this.rot.w);
      w.Write(this.scl.x);
      w.Write(this.scl.y);
      w.Write(this.scl.z);
    }

    public void Import(BinaryReader r)
    {
      int num = (int) r.ReadByte();
      this.id = r.ReadInt32();
      this.protoId = r.ReadInt16();
      this.modelIndex = r.ReadInt16();
      this.hp = r.ReadInt16();
      this.pos.x = r.ReadSingle();
      this.pos.y = r.ReadSingle();
      this.pos.z = r.ReadSingle();
      this.rot.x = r.ReadSingle();
      this.rot.y = r.ReadSingle();
      this.rot.z = r.ReadSingle();
      this.rot.w = r.ReadSingle();
      this.scl.x = r.ReadSingle();
      this.scl.y = r.ReadSingle();
      this.scl.z = r.ReadSingle();
    }
  }
}
